﻿using log4net;
using System;

namespace OConf.Common
{
    public class Log4NetHelper
    {
        private readonly static ILog _log = LogManager.GetLogger("InfoLog");

        /// <summary>
        /// 普通日志
        /// </summary>
        /// <param name="message">日志内容</param>
        public static void WriteInfoLog(string message)
        {
            if (_log.IsInfoEnabled)
            {
                _log.Info(message);
            }
        }

        /// <summary>
        /// 记录埋点日志
        /// </summary>
        /// <param name="message"></param>
        public static void WriteBuriedPointLog(string message)
        {
            if (_log.IsDebugEnabled)
            {
                _log.Debug(message);
            }
        }

        /// <summary>
        /// 记录异常日志
        /// </summary>
        /// <param name="ex"></param>
        public static void WriteExceptionLog(Exception ex)
        {
            if (_log.IsErrorEnabled)
            {
                _log.Error(ex);
            }
        }

        /// <summary>
        /// 记录异常日志
        /// </summary>
        /// <param name="ex"></param>
        public static void WriteExceptionLog(string message, Exception ex)
        {
            if (_log.IsErrorEnabled)
            {
                _log.Error(message, ex);
            }
        }
    }
}
